package com.diankangwo.dao.impl;


import com.diankangwo.dao.SpeciesDAO;
import com.diankangwo.domain.Species;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class SpeciesDAOImpl extends BaseDaoImpl<Species> implements SpeciesDAO {


    @Override
    public List<Species> findByTypeId(Integer id) {
        List<Species> speist = new ArrayList<Species>();
        speist =  findByQuery("from Species spe where spe.classificationsId = ?", id);
        if (speist == null || speist.size() ==0) {
            return null;
        }else{
            return speist;
        }
    }
}
